<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery/jquery.min.js"></script>
</head>
<body>
<button id="btn1">查所有</button>
<button id="btn2">新增</button>
<button id="btn3">删除</button>
<button id="btn4">修改</button>
<button id="btn5">查一条</button>
</body>
<script>

        $('#btn1').click(function () {
            //参数 路径 参数 回调函数
            $.get("/employees",{},function (data) {
                console.log(data);
            });
        });

        $('#btn2').click(function () {
            //新增 传递一个id为100
            $.post("/employees",{name:"张三",age:18},function (data) {
                console.log(data);
            });
        });

        //删除的delete 方法没有封装 需要使用 $.ajax
        $('#btn3').click(function () {
            $.ajax({
                url:"/employees",
                type:"DELETE",
                data:{id: 100},//参数
                success:function (data) {
                    console.log(data)
                }
            });
        });

        //修改
        $('#btn4').click(function () {
            $.ajax({
                url:"/employees",
                type:"PUT",
                data:{id: 100,name: "你好",age:18},
                success:function (data) {
                    console.log(data)
                }
            });
        });

        $('#btn5').click(function () {
            $.ajax({
                url:"/employees/100",
                type:"get",
                data:{},
                success:function (data) {
                    console.log(data)
                }
            });
        });



</script>

</html>